package com.ndp.fb.scheduler.job.rulescript;

import com.alibaba.dubbo.config.annotation.Reference;
import com.ndp.fb.constant.ConfigConst;
import com.ndp.fb.rulescript.api.RuleResultClean;
import com.ndp.fb.scheduler.annotation.CronScheduled;
import com.ndp.fb.util.DateFormatUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * Created by hunk.qin on 2015/9/2.
 */
@Component
public class RuleScriptJob {

    private static Logger logger = LoggerFactory.getLogger(RuleScriptJob.class);

    @Reference
    private RuleResultClean ruleResultClean;

    @CronScheduled(cronkey = ConfigConst.RULESCRIPT_RESULT_CLEAN_CRON,enablekey =ConfigConst.RULESCRIPT_RESULT_CLEAN_ENABLE)
    public void  clearALLResult() {
        logger.info("===start clear all rule result time:{}====", DateFormatUtil.formatLong19(new Date()));
        ruleResultClean.cleanAllResultIgnoreOptLog();
    }
}
